home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-09-27 | 49.1 KB | 1,734 lines |
- Newsgroups: comp.sources.misc
- From: steve@robobar.co.uk (Steve Bleazard)
- Subject: v23i029: xenix-gnu - Xenix 386 patchkit for GCC / GAS and GDB, Part02/03
- Message-ID: <1991Sep27.045947.16068@sparky.imd.sterling.com>
- X-Md4-Signature: 3354e5389895d7771f01f8d3006c86e1
- Date: Fri, 27 Sep 1991 04:59:47 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: steve@robobar.co.uk (Steve Bleazard)
- Posting-number: Volume 23, Issue 29
- Archive-name: xenix-gnu/part02
- Environment: SCOXENIX
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: gdb-3.5b.pch
- # Wrapped by kent@sparky on Thu Sep 26 23:30:11 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive."'
- if test -f 'gdb-3.5b.pch' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'gdb-3.5b.pch'\"
- else
- echo shar: Extracting \"'gdb-3.5b.pch'\" \(46618 characters\)
- sed "s/^X//" >'gdb-3.5b.pch' <<'END_OF_FILE'
- X*** 3.5/Makefile.dist Wed Jan 31 03:42:57 1990
- X--- Makefile.dist Thu Aug 1 18:01:18 1991
- X***************
- X*** 124,130 ****
- X kdb-start.c main.c printcmd.c \
- X remote.c source.c stack.c standalone.c stuff.c symmisc.c symtab.c \
- X utils.c valarith.c valops.c valprint.c values.c version.c expread.y \
- X! xgdb.c
- X
- X DEPFILES = umax-dep.c gould-dep.c default-dep.c sun3-dep.c \
- X sparc-dep.c hp9k320-dep.c hp300bsd-dep.c news-dep.c i386-dep.c \
- X--- 124,130 ----
- X kdb-start.c main.c printcmd.c \
- X remote.c source.c stack.c standalone.c stuff.c symmisc.c symtab.c \
- X utils.c valarith.c valops.c valprint.c values.c version.c expread.y \
- X! x386dbx.c xgdb.c
- X
- X DEPFILES = umax-dep.c gould-dep.c default-dep.c sun3-dep.c \
- X sparc-dep.c hp9k320-dep.c hp300bsd-dep.c news-dep.c i386-dep.c \
- X***************
- X*** 173,179 ****
- X
- X OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \
- X values.o eval.o valops.o valarith.o valprint.o printcmd.o \
- X! symtab.o symmisc.o coffread.o dbxread.o infcmd.o infrun.o remote.o \
- X command.o utils.o expread.o expprint.o pinsn.o environ.o version.o \
- X copying.o ${READLINEOBS}
- X
- X--- 173,179 ----
- X
- X OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \
- X values.o eval.o valops.o valarith.o valprint.o printcmd.o \
- X! symtab.o symmisc.o coffread.o dbxread.o x386dbx.o infcmd.o infrun.o remote.o \
- X command.o utils.o expread.o expprint.o pinsn.o environ.o version.o \
- X copying.o ${READLINEOBS}
- X
- X*** 3.5/config.gdb Tue Jan 30 21:35:46 1990
- X--- config.gdb Thu Aug 1 19:36:23 1991
- X***************
- X*** 326,331 ****
- X--- 326,337 ----
- X pinsnfile=three
- X opcodefile=four
- X ;;
- X+ xenix386)
- X+ makedefine="-DM_CLIBS=-lx -DM_REGEX=regex.o -Dcc=gcc -DM_CFLAGS=-traditional"
- X+ pinsnfile=i386-pinsn.c
- X+ opcodefile=m-xenix386.h
- X+ depfile=i386-dep.c # patched with #ifdef M_XENIX
- X+ ;;
- X *)
- X echo "Unknown machine type: \`$machine'"
- X echo "Available types:"
- X***************
- X*** 369,375 ****
- X # edit the makefile
- X echo "Editing Makefile"
- X cp Makefile.dist tmp.c
- X! cc -E >Makefile tmp.c $makedefine -DM_MAKEDEFINE="$makedefine"
- X rm -f tmp.c
- X
- X echo "GDB is now set up for use with a $machine." \
- X--- 375,381 ----
- X # edit the makefile
- X echo "Editing Makefile"
- X cp Makefile.dist tmp.c
- X! gcc -Ui386 -E >Makefile $makedefine -DM_MAKEDEFINE="$makedefine" tmp.c
- X rm -f tmp.c
- X
- X echo "GDB is now set up for use with a $machine." \
- X*** 3.5/core.c Thu Jan 11 00:55:17 1990
- X--- core.c Thu Aug 1 18:01:22 1991
- X***************
- X*** 49,54 ****
- X--- 49,59 ----
- X #ifdef UMAX_CORE
- X #include <sys/ptrace.h>
- X #else
- X+ #ifdef M_XENIX
- X+ struct user; struct buf; struct inode; struct proc; /* inhibit warnings */
- X+ #include <sys/page.h>
- X+ #include <sys/seg.h>
- X+ #endif
- X #include <sys/user.h>
- X #endif
- X
- X***************
- X*** 62,70 ****
- X--- 67,79 ----
- X
- X #ifndef COFF_FORMAT
- X #ifndef AOUTHDR
- X+ #ifdef M_XENIX
- X+ #define AOUTHDR struct xexec
- X+ #else
- X #define AOUTHDR struct exec
- X #endif
- X #endif
- X+ #endif
- X
- X extern char *sys_siglist[];
- X
- X***************
- X*** 200,209 ****
- X the core file, (s)he'll find out soon enough. */
- X return;
- X
- X if (N_MAGIC (core_aouthdr) != 0
- X && bcmp (&core_aouthdr, &exec_aouthdr, sizeof core_aouthdr))
- X printf ("Warning: core file does not match specified executable file.\n");
- X! else if (exec_mtime > st_core.st_mtime)
- X printf ("Warning: exec file is newer than core file.\n");
- X }
- X }
- X--- 209,222 ----
- X the core file, (s)he'll find out soon enough. */
- X return;
- X
- X+ /* cannot validate core file against executable file on xenix */
- X+ #ifndef M_XENIX
- X if (N_MAGIC (core_aouthdr) != 0
- X && bcmp (&core_aouthdr, &exec_aouthdr, sizeof core_aouthdr))
- X printf ("Warning: core file does not match specified executable file.\n");
- X! else
- X! #endif
- X! if (exec_mtime > st_core.st_mtime)
- X printf ("Warning: exec file is newer than core file.\n");
- X }
- X }
- X*** 3.5/dbxread.c Sat Jan 27 08:30:54 1990
- X--- dbxread.c Thu Aug 1 19:25:46 1991
- X***************
- X*** 40,45 ****
- X--- 40,60 ----
- X #define L_INCR 1
- X #endif
- X
- X+ #ifdef M_XENIX
- X+ #include <sys/relsym.h>
- X+ #define nlist xenix_nlist /* the system nlist is broken */
- X+ #include <a.out.h>
- X+ #undef nlist
- X+ #define nlist gas_nlist
- X+ #include "stab.gnu.h"
- X+ #include "gas-nlist.h"
- X+
- X+ #define STRING_SEG 4
- X+ #define SYMS_SEG 5
- X+ #define AOUTHDR struct xexec
- X+
- X+ #else /* M_XENIX */
- X+
- X #ifdef COFF_ENCAPSULATE
- X #include "a.out.encap.h"
- X #include "stab.gnu.h"
- X***************
- X*** 47,52 ****
- X--- 62,69 ----
- X #include <a.out.h>
- X #include <stab.h>
- X #endif
- X+ #endif /* M_XENIX */
- X+
- X #include <ctype.h>
- X
- X #ifndef NO_GNU_STABS
- X***************
- X*** 167,172 ****
- X--- 184,222 ----
- X /* C++ */
- X static struct type **read_args ();
- X
- X+ #ifdef M_XENIX
- X+ extern struct xseg *find_segment();
- X+ #define NUMBER_OF_SYMBOLS \
- X+ ({ struct xseg *cseg; long z;\
- X+ cseg = find_segment(XS_TSYMS, SYMS_SEG); \
- X+ z = cseg ? cseg->xs_psize / sizeof(struct nlist) : 0; z;})
- X+ #define SYMBOL_TABLE_OFFSET \
- X+ ({ struct xseg *cseg; long z;\
- X+ cseg = find_segment(XS_TSYMS, SYMS_SEG); \
- X+ z = cseg ? cseg->xs_filpos : 0; z;})
- X+ #define STRING_TABLE_OFFSET \
- X+ ({ struct xseg *cseg; long z;\
- X+ cseg = find_segment(XS_TSYMS, STRING_SEG); \
- X+ z = cseg ? cseg->xs_filpos : 0; z; })
- X+ #define READ_STRING_TABLE_SIZE(INTO) \
- X+ { struct xseg *cseg; \
- X+ cseg = find_segment(XS_TSYMS, STRING_SEG); \
- X+ INTO = cseg ? cseg->xs_psize : 0; }
- X+ #define N_BADMAG(hdr)\
- X+ (hdr.x_magic != X_MAGIC && (hdr.x_cpu & XC_CPU) != XC_386 \
- X+ && (hdr.x_renv & XE_SEG) == 0 && (hdr.x_renv & XE_EXEC) == 0)
- X+ #define READ_FILE_HEADERS(DESC, NAME) \
- X+ { val = myread (DESC, &hdr, sizeof hdr); \
- X+ if (val < 0) perror_with_name (NAME); \
- X+ if (N_BADMAG (hdr)) \
- X+ error ("File \"%s\" not in executable format.", NAME);\
- X+ process_a_out(DESC, NAME); }
- X+ #define IS_OBJECT_FILE 0
- X+ #define SIZE_OF_TEXT_SEGMENT hdr.x_text
- X+ #define ADDR_OF_TEXT_SEGMENT 0
- X+ #define ENTRY_POINT hdr.x_entry
- X+ #endif
- X+
- X /* Macro to determine which symbols to ignore when reading the first symbol
- X of a file. Some machines override this definition. */
- X #ifdef N_NSYMS
- X***************
- X*** 336,341 ****
- X--- 386,394 ----
- X /* Count symbols as they are processed, for error messages. */
- X
- X static int symnum;
- X+ #ifdef M_XENIX
- X+ static long lsym_count = 0;
- X+ #endif /* M_XENIX */
- X
- X /* Vector of types defined so far, indexed by their dbx type numbers.
- X (In newer sun systems, dbx uses a pair of numbers in parens,
- X***************
- X*** 1627,1632 ****
- X--- 1680,1691 ----
- X old_chain = make_cleanup (close, desc);
- X make_cleanup (free_current_contents, &name);
- X
- X+ #ifdef M_XENIX
- X+ /* On xenix (with gcc) READ_FILE_HEADER reads the segment table,
- X+ * fileinfo table and global symbol table as well.
- X+ */
- X+ #endif /* M_XENIX */
- X+
- X READ_FILE_HEADERS (desc, name);
- X
- X entry_point = ENTRY_POINT;
- X***************
- X*** 1676,1681 ****
- X--- 1735,1744 ----
- X val = myread (desc, stringtab, buffer);
- X if (val < 0)
- X perror_with_name (name);
- X+ #ifdef X_DEBUG
- X+ printf("\nstring table offset = %d, size = %d, start = %s\n",
- X+ STRING_TABLE_OFFSET, buffer, stringtab);
- X+ #endif
- X
- X /* Throw away the old symbol table. */
- X
- X***************
- X*** 1720,1726 ****
- X--- 1783,1793 ----
- X
- X /* Go over the misc functions and install them in vector. */
- X
- X+ #ifndef M_XENIX /* This has already been done at header read time */
- X condense_misc_bunches (0);
- X+ #else
- X+ process_global_symbol_table(desc, name);
- X+ #endif /* M_XENIX */
- X
- X /* Don't allow char * to have a typename (else would get caddr_t.) */
- X
- X***************
- X*** 1799,1805 ****
- X {
- X if (symbuf_idx == symbuf_end)
- X fill_symbuf ();
- X! symnum++;
- X return symbuf[symbuf_idx++].n_un.n_strx + stringtab_global;
- X }
- X
- X--- 1866,1872 ----
- X {
- X if (symbuf_idx == symbuf_end)
- X fill_symbuf ();
- X! symnum++; lsym_count--;
- X return symbuf[symbuf_idx++].n_un.n_strx + stringtab_global;
- X }
- X
- X***************
- X*** 1937,1942 ****
- X--- 2004,2019 ----
- X int global_funs = 0;
- X #endif
- X
- X+ #ifdef M_XENIX
- X+ long flsym_count = 0;
- X+ long file_string_base = 0;
- X+ long stringtab_offset = 0;
- X+ long symtab_pos = 0;
- X+ long filadd = 0;
- X+ long textsize = 0;
- X+ int file_count = 0;
- X+ #endif /* M_XENIX */
- X+
- X /* Current partial symtab */
- X struct partial_symtab *pst;
- X
- X***************
- X*** 1989,1998 ****
- X--- 2066,2123 ----
- X symtab_input_desc = desc; /* This is needed for fill_symbuf below */
- X symbuf_end = symbuf_idx = 0;
- X
- X+ #ifdef M_XENIX
- X+ init_fileinfo_processing(); /* start processing the list of files */
- X+ nlistlen += 10; /* force the hack code to terminate the loop */
- X+ lsym_count = 0;
- X+ #endif /* M_XENIX */
- X+
- X for (symnum = 0; symnum < nlistlen; symnum++)
- X {
- X /* Get the symbol for this run and pull out some info */
- X QUIT; /* allow this to be interruptable */
- X+ #ifdef M_XENIX
- X+
- X+ /* This is a gross hack. Xenix places pointers to each files $$SYMBOLS
- X+ * (containing the symbols for DBX) and $$TYPES (containing the strings
- X+ * for DBX) in the file name table. There is also a partial symbol
- X+ * table record for each file produced by the loader - this is ignored
- X+ * at present.
- X+ */
- X+ if (lsym_count == 0)
- X+ {
- X+ try_next_file:
- X+ if (!get_next_fileinfo(&stringtab_offset, &flsym_count, &filadd,
- X+ &symtab_pos, &textsize))
- X+ { /* all files proccessed */
- X+ symnum = nlistlen;
- X+ continue;
- X+ }
- X+ else
- X+ {
- X+ lseek(desc, symtab_pos, 0);
- X+ stringtab_global = stringtab + stringtab_offset;
- X+ symbuf_idx = symbuf_end; /* force symbol reading */
- X+ lsym_count = flsym_count;
- X+ }
- X+
- X+ file_count++;
- X+
- X+ if (file_count == 2)
- X+ startup_file_start = filadd;
- X+
- X+ if (file_count == 3)
- X+ startup_file_end = filadd;
- X+
- X+ if (lsym_count == 0) /* skip this file if no symbols in it */
- X+ goto try_next_file;
- X+
- X+ }
- X+
- X+
- X+ lsym_count--;
- X+
- X+ #endif /* M_XENIX */
- X if (symbuf_idx == symbuf_end)
- X fill_symbuf ();
- X bufp = &symbuf[symbuf_idx++];
- X***************
- X*** 2023,2029 ****
- X if (bufp->n_un.n_strx < 0 || bufp->n_un.n_strx >= stringtab_size) \
- X error ("Invalid symbol data: bad string table offset: %d", \
- X bufp->n_un.n_strx); \
- X! namestring = bufp->n_un.n_strx + stringtab
- X
- X #define ADD_PSYMBOL_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE)\
- X do { \
- X--- 2148,2154 ----
- X if (bufp->n_un.n_strx < 0 || bufp->n_un.n_strx >= stringtab_size) \
- X error ("Invalid symbol data: bad string table offset: %d", \
- X bufp->n_un.n_strx); \
- X! namestring = bufp->n_un.n_strx + stringtab + stringtab_offset
- X
- X #define ADD_PSYMBOL_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE)\
- X do { \
- X***************
- X*** 2051,2062 ****
- X SYMBOL_VALUE (psym) = (VALUE); \
- X } while (0);
- X
- X
- X! switch (bufp->n_type)
- X {
- X /*
- X * Standard, non-debugger, symbols
- X */
- X
- X case N_TEXT | N_EXT:
- X /* Catch etext */
- X--- 2176,2193 ----
- X SYMBOL_VALUE (psym) = (VALUE); \
- X } while (0);
- X
- X+ #ifdef X_DEBUG
- X+ printf("%s = (%#x, %d, %#x)\n",
- X+ bufp->n_un.n_strx ? bufp->n_un.n_strx+stringtab+stringtab_offset : "<NONE>",
- X+ (unsigned char)bufp->n_type, bufp->n_desc, bufp->n_value);
- X+ #endif /* X_DEBUG */
- X
- X! switch ((unsigned char)bufp->n_type)
- X {
- X /*
- X * Standard, non-debugger, symbols
- X */
- X+ #ifndef M_XENIX /* these are not present with Xenix / GCC */
- X
- X case N_TEXT | N_EXT:
- X /* Catch etext */
- X***************
- X*** 2176,2181 ****
- X--- 2307,2314 ----
- X case N_NBBSS:
- X #endif
- X
- X+ #endif /* M_XENIX */
- X+
- X /* Keep going . . .*/
- X
- X /*
- X***************
- X*** 2209,2218 ****
- X--- 2342,2358 ----
- X
- X if (pst && past_first_source_file)
- X {
- X+ #ifndef M_XENIX
- X end_psymtab (pst, psymtab_include_list, includes_used,
- X symnum * sizeof (struct nlist), bufp->n_value,
- X dependency_list, dependencies_used,
- X global_psymbols.next, static_psymbols.next);
- X+ #else
- X+ end_psymtab (pst, psymtab_include_list, includes_used,
- X+ symtab_pos + flsym_count * sizeof (struct nlist),
- X+ bufp->n_value, dependency_list, dependencies_used,
- X+ global_psymbols.next, static_psymbols.next);
- X+ #endif
- X pst = (struct partial_symtab *) 0;
- X includes_used = 0;
- X dependencies_used = 0;
- X***************
- X*** 2220,2228 ****
- X--- 2360,2374 ----
- X else
- X past_first_source_file = 1;
- X
- X+ #ifndef M_XENIX
- X pst = start_psymtab (namestring, bufp->n_value,
- X symnum * sizeof (struct nlist),
- X global_psymbols.next, static_psymbols.next);
- X+ #else
- X+ pst = start_psymtab (namestring, bufp->n_value, symtab_pos,
- X+ global_psymbols.next, static_psymbols.next,
- X+ stringtab_offset, flsym_count, textsize);
- X+ #endif /* M_XENIX */
- X
- X continue;
- X
- X***************
- X*** 2591,2596 ****
- X--- 2737,2743 ----
- X }
- X
- X /* If there's stuff to be cleaned up, clean it up. */
- X+ #ifndef M_XENIX
- X if (entry_point < bufp->n_value
- X && entry_point >= last_o_file_start)
- X {
- X***************
- X*** 2597,2609 ****
- X--- 2744,2764 ----
- X startup_file_start = last_o_file_start;
- X startup_file_end = bufp->n_value;
- X }
- X+ #endif /* M_XENIX */
- X
- X if (pst)
- X {
- X+ #ifndef M_XENIX
- X end_psymtab (pst, psymtab_include_list, includes_used,
- X symnum * sizeof (struct nlist), end_of_text_addr,
- X dependency_list, dependencies_used,
- X global_psymbols.next, static_psymbols.next);
- X+ #else /* M_XENIX */
- X+ end_psymtab (pst, psymtab_include_list, includes_used,
- X+ symtab_pos + flsym_count * sizeof (struct nlist),
- X+ end_of_text_addr, dependency_list, dependencies_used,
- X+ global_psymbols.next, static_psymbols.next);
- X+ #endif /* M_XENIX */
- X includes_used = 0;
- X dependencies_used = 0;
- X pst = (struct partial_symtab *) 0;
- X***************
- X*** 2653,2658 ****
- X--- 2808,2814 ----
- X * completely filled at the end of the symbol list.
- X */
- X static struct partial_symtab *
- X+ #ifndef M_XENIX
- X start_psymtab (filename, textlow, ldsymoff, global_syms, static_syms)
- X char *filename;
- X int textlow;
- X***************
- X*** 2659,2664 ****
- X--- 2815,2832 ----
- X int ldsymoff;
- X struct partial_symbol *global_syms;
- X struct partial_symbol *static_syms;
- X+ #else
- X+ start_psymtab (filename, textlow, ldsymoff, global_syms, static_syms, stroffset,
- X+ symcount, textsize)
- X+ char *filename;
- X+ int textlow;
- X+ int ldsymoff;
- X+ struct partial_symbol *global_syms;
- X+ struct partial_symbol *static_syms;
- X+ int stroffset;
- X+ int symcount;
- X+ long textsize;
- X+ #endif
- X {
- X struct partial_symtab *result =
- X (struct partial_symtab *) obstack_alloc (psymbol_obstack,
- X***************
- X*** 2671,2677 ****
- X
- X result->textlow = textlow;
- X result->ldsymoff = ldsymoff;
- X!
- X result->readin = 0;
- X
- X result->globals_offset = global_syms - global_psymbols.list;
- X--- 2839,2848 ----
- X
- X result->textlow = textlow;
- X result->ldsymoff = ldsymoff;
- X! #ifdef M_XENIX
- X! result->texthigh = textlow + textsize;
- X! result->ldsymlen = symcount * sizeof(struct nlist);
- X! #endif
- X result->readin = 0;
- X
- X result->globals_offset = global_syms - global_psymbols.list;
- X***************
- X*** 2679,2684 ****
- X--- 2850,2856 ----
- X
- X result->n_global_syms = 0;
- X result->n_static_syms = 0;
- X+ result->stringtab_off = stroffset;
- X
- X return result;
- X }
- X***************
- X*** 2722,2729 ****
- X--- 2894,2903 ----
- X {
- X int i;
- X
- X+ #ifndef M_XENIX
- X pst->ldsymlen = capping_symbol_offset - pst->ldsymoff;
- X pst->texthigh = capping_text;
- X+ #endif /* M_XENIX */
- X
- X pst->n_global_syms =
- X capping_global - (global_psymbols.list + pst->globals_offset);
- X***************
- X*** 2830,2840 ****
- X--- 3004,3023 ----
- X old_chain = make_cleanup (really_free_pendings, 0);
- X
- X /* Read in this files symbols */
- X+ #ifndef M_XENIX
- X lseek (desc, sym_offset, L_SET);
- X+
- X read_ofile_symtab (desc, stringtab, stringtab_size,
- X pst->ldsymoff,
- X pst->ldsymlen, pst->textlow,
- X pst->texthigh - pst->textlow, 0);
- X+ #else /* M_XENIX */
- X+ read_ofile_symtab (desc, stringtab + pst->stringtab_off,
- X+ stringtab_size - pst->stringtab_off,
- X+ pst->ldsymoff,
- X+ pst->ldsymlen, pst->textlow,
- X+ pst->texthigh - pst->textlow, 0);
- X+ #endif /* M_XENIX */
- X sort_symtab_syms (symtab_list); /* At beginning since just added */
- X
- X do_cleanups (old_chain);
- X***************
- X*** 2903,2909 ****
- X--- 3086,3094 ----
- X if (desc < 0)
- X error("Symbol file not readable");
- X
- X+ #ifndef M_XENIX
- X READ_FILE_HEADERS (desc, name);
- X+ #endif /* M_XENIX */
- X
- X /* Read in the string table */
- X lseek (desc, STRING_TABLE_OFFSET, L_SET);
- X***************
- X*** 3058,3063 ****
- X--- 3243,3249 ----
- X symtab_input_desc = desc;
- X symbuf_end = symbuf_idx = 0;
- X
- X+ #ifndef M_XENIX
- X /* It is necessary to actually read one symbol *before* the start
- X of this symtab's symbols, because the GCC_COMPILED_FLAG_SYMBOL
- X occurs before the N_SO symbol.
- X***************
- X*** 3087,3092 ****
- X--- 3273,3285 ----
- X lseek(desc, sym_offset, L_INCR);
- X processing_gcc_compilation = 0;
- X }
- X+ #else /* M_XENIX */
- X+ lseek(desc, sym_offset, L_SET);
- X+ processing_gcc_compilation = 0;
- X+ #ifdef X_DEBUG
- X+ printf("sym_offset = %d, sym_size = %d\n", sym_offset, sym_size);
- X+ #endif /* X_DEBUG */
- X+ #endif /* M_XENIX */
- X
- X if (symbuf_idx == symbuf_end)
- X fill_symbuf();
- X***************
- X*** 3094,3099 ****
- X--- 3287,3298 ----
- X if ((unsigned char) bufp->n_type != N_SO)
- X fatal("First symbol in segment of executable not a source symbol");
- X
- X+ #ifdef X_DEBUG
- X+ printf("%s = (%#x, %d, %#x)\n",
- X+ bufp->n_un.n_strx ? bufp->n_un.n_strx+stringtab : "<NONE>",
- X+ (unsigned char)bufp->n_type, bufp->n_desc, bufp->n_value);
- X+ #endif /* X_DEBUG */
- X+
- X for (symnum = 0;
- X symnum < sym_size / sizeof(struct nlist);
- X symnum++)
- X***************
- X*** 3103,3108 ****
- X--- 3302,3312 ----
- X fill_symbuf();
- X bufp = &symbuf[symbuf_idx++];
- X type = bufp->n_type;
- X+ #ifdef X_DEBUG
- X+ printf("%s = (%#x, %d, %#x)\n",
- X+ bufp->n_un.n_strx ? bufp->n_un.n_strx+stringtab : "<NONE>",
- X+ (unsigned char)bufp->n_type, bufp->n_desc, bufp->n_value);
- X+ #endif /* X_DEBUG */
- X
- X if (offset &&
- X (type == N_TEXT || type == N_DATA || type == N_BSS))
- X***************
- X*** 3476,3481 ****
- X--- 3680,3687 ----
- X
- X /* Read in another .o file and create a symtab entry for it.*/
- X
- X+ #ifndef M_XENIX /* Xenix can't do incremental loads */
- X+
- X static void
- X read_addl_syms (desc, stringtab, nlistlen, text_addr, text_size)
- X int desc;
- X***************
- X*** 3772,3777 ****
- X--- 3978,3984 ----
- X printf ("done.\n");
- X fflush (stdout);
- X }
- X+ #endif /* M_XENIX */
- X
- X /* Read a number by which a type is referred to in dbx data,
- X or perhaps read a pair (FILENUM, TYPENUM) in parentheses.
- X***************
- X*** 5469,5476 ****
- X--- 5676,5685 ----
- X add_com ("symbol-file", class_files, symbol_file_command,
- X "Load symbol table (in dbx format) from executable file FILE.");
- X
- X+ #ifndef M_XENIX
- X add_com ("add-file", class_files, add_file_command,
- X "Load the symbols from FILE, assuming its code is at TEXT_START.") ;
- X+ #endif /* M_XENIX */
- X }
- X
- X #endif /* READ_DBX_FORMAT */
- X*** 3.5/gas-nlist.h
- X--- gas-nlist.h Thu Aug 1 18:01:31 1991
- X***************
- X*** 0 ****
- X--- 1,13 ----
- X+ #define N_STAB 0340
- X+
- X+ struct gas_nlist {
- X+ union {
- X+ char *n_name;
- X+ struct gas_nlist *n_next;
- X+ long n_strx;
- X+ } n_un;
- X+ char n_type;
- X+ char n_other;
- X+ short n_desc;
- X+ unsigned n_value;
- X+ };
- X*** 3.5/i386-dep.c Thu Jan 11 00:58:05 1990
- X--- i386-dep.c Thu Aug 1 18:01:33 1991
- X***************
- X*** 30,35 ****
- X--- 30,49 ----
- X #include <sys/param.h>
- X #include <sys/dir.h>
- X #include <signal.h>
- X+ #ifdef M_XENIX
- X+ struct user; struct buf; struct inode; struct proc; /* inhibit warnings */
- X+ #include <sys/page.h>
- X+ #include <sys/seg.h>
- X+ #define a_magic xa_magic
- X+ #define a_text xa_text
- X+ #define exec xexec
- X+ #undef U_FPSTATE
- X+ #define U_FPSTATE(u) u.u_fps
- X+ #define fpstate u_fps
- X+ #define u_fpvalid u_fpsaved
- X+ unsigned short text_segid; /* segment number of text segment */
- X+ unsigned short data_segid; /* segment number of data segment */
- X+ #endif
- X #include <sys/user.h>
- X #include <sys/ioctl.h>
- X #include <fcntl.h>
- X***************
- X*** 37,44 ****
- X--- 51,60 ----
- X #ifdef COFF_ENCAPSULATE
- X #include "a.out.encap.h"
- X #else
- X+ #ifndef M_XENIX /* already included by sys/user.h */
- X #include <a.out.h>
- X #endif
- X+ #endif
- X
- X #ifndef N_SET_MAGIC
- X #ifdef COFF_FORMAT
- X***************
- X*** 50,57 ****
- X--- 66,94 ----
- X
- X #include <sys/file.h>
- X #include <sys/stat.h>
- X+ #ifdef M_XENIX
- X+ #include <sys/proc.h>
- X+ #endif
- X
- X #include <sys/reg.h>
- X+ #ifdef M_XENIX
- X+ #define SS RSS
- X+ #define UESP RESP
- X+ #define EFL REFL
- X+ #define CS RCS
- X+ #define EIP REIP
- X+ #define EAX REAX
- X+ #define ECX RECX
- X+ #define EDX REDX
- X+ #define EBX REBX
- X+ #define EBP REBP
- X+ #define ESI RESI
- X+ #define EDI REDI
- X+ #define DS RDS
- X+ #define ES RES
- X+ #define FS RFS
- X+ #define GS RGS
- X+ #endif
- X
- X extern int errno;
- X
- X***************
- X*** 62,68 ****
- X--- 99,120 ----
- X call_ptrace (request, pid, arg3, arg4)
- X int request, pid, arg3, arg4;
- X {
- X+ #ifdef M_XENIX
- X+ extern CORE_ADDR text_end;
- X+ int addr_in_data_segment = arg3 > text_end;
- X+ #ifdef PTRACE_ADDR_ARG_STRUCT
- X+ struct saddr addr;
- X+ addr.sa_seg = addr_in_data_segment ? data_segid : text_segid;
- X+ if (request == 7 || request == 9) addr.sa_seg = 0;
- X+ addr.sa_off = arg3;
- X+ arg3 = (int) &addr;
- X+ #endif
- X+ if (addr_in_data_segment && (request == 1 || request == 4)) request++;
- X+ return ptrace (request, pid, arg3, arg4);
- X+ #define ptrace(a, b, c, d) call_ptrace(a, b, c, d)
- X+ #else
- X return ptrace (request, pid, arg3, arg4);
- X+ #endif /* M_XENIX */
- X }
- X
- X kill_inferior ()
- X***************
- X*** 157,163 ****
- X--- 209,220 ----
- X perror_with_name (buf);
- X }
- X }
- X+ #ifdef M_XENIX
- X+ /* HACK: Xenix ptrace() disallows writing to where es, fs and gs are kept */
- X+ else for (regno = 0; regno < (NUM_REGS - 3); regno++)
- X+ #else
- X else for (regno = 0; regno < NUM_REGS; regno++)
- X+ #endif
- X {
- X regaddr = register_addr (regno, offset);
- X errno = 0;
- X***************
- X*** 382,389 ****
- X--- 439,451 ----
- X
- X data_start = 0;
- X data_end = 0;
- X+ #ifdef M_XENIX
- X+ stack_start = 0;
- X+ stack_end = 0;
- X+ #else
- X stack_start = STACK_END_ADDR;
- X stack_end = STACK_END_ADDR;
- X+ #endif
- X
- X /* Now, if a new core file was specified, open it and digest it. */
- X
- X***************
- X*** 406,411 ****
- X--- 468,474 ----
- X val = myread (corechan, &u, sizeof u);
- X if (val < 0)
- X perror_with_name (filename);
- X+ #ifndef M_XENIX
- X data_start = exec_data_start;
- X
- X data_end = data_start + NBPG * u.u_dsize;
- X***************
- X*** 412,417 ****
- X--- 475,490 ----
- X stack_start = stack_end - NBPG * u.u_ssize;
- X data_offset = NBPG * UPAGES;
- X stack_offset = NBPG * (UPAGES + u.u_dsize);
- X+ #else
- X+ data_start = (CORE_ADDR)u.u_sdata;
- X+ data_end = (CORE_ADDR)u.u_edatau;
- X+ stack_start = (CORE_ADDR)u.u_stktop;
- X+ stack_end = (CORE_ADDR)u.u_stkbotu;
- X+
- X+ data_offset = lseek(corechan, 0L, 2) - u.u_dsize;
- X+ stack_offset = (((sizeof u + (u.u_ldtlimit-1)*sizeof(struct descriptor)
- X+ + NBPC - 1) / NBPC) * NBPC);
- X+ #endif
- X reg_offset = (int) u.u_ar0 - KERNEL_U_ADDR;
- X
- X /* I don't know where to find this info.
- X***************
- X*** 523,529 ****
- X--- 596,651 ----
- X exec_mtime = file_hdr.f_timdat;
- X }
- X #else /* not COFF_FORMAT */
- X+ #ifdef M_XENIX
- X {
- X+ char *extended_header;
- X+ struct xext *xext;
- X+ struct stat st_exec;
- X+ struct xseg xseg;
- X+ extern char *malloc();
- X+ val = myread (execchan, &exec_aouthdr, sizeof (AOUTHDR));
- X+
- X+ if (val < 0)
- X+ perror_with_name (filename);
- X+ if (exec_aouthdr.x_magic != X_MAGIC)
- X+ error ("\"%s\": not in executable format.", execfile);
- X+ if ( (exec_aouthdr.x_cpu & XC_CPU) != XC_386 )
- X+ error ("\"%s\": not a 386 executable.", execfile);
- X+ if ( (exec_aouthdr.x_renv & XE_SEG) == 0)
- X+ error ("\"%s\": not a segmented executable.", execfile);
- X+ if ( (exec_aouthdr.x_renv & XE_EXEC) == 0)
- X+ error ("\"%s\": not executable.", execfile);
- X+ extended_header = malloc(exec_aouthdr.x_ext);
- X+ val = myread (execchan, extended_header, exec_aouthdr.x_ext);
- X+ if (val < 0)
- X+ perror_with_name (filename);
- X+ xext = (struct xext *)extended_header;
- X+ lseek(execchan, xext->xe_segpos, 0);
- X+ if (myread (execchan, (char *)&xseg, sizeof(xseg)) < 0)
- X+ perror_with_name (filename);
- X+ if ( xseg.xs_type != XS_TTEXT )
- X+ error ("\"%s\": Text segment isn't first (huh?).", execfile);
- X+ text_segid = xseg.xs_seg;
- X+ text_start = xseg.xs_rbase;
- X+ text_end = text_start + xseg.xs_vsize;
- X+ text_offset = xseg.xs_filpos;
- X+
- X+ if (myread (execchan, (char *)&xseg, sizeof(xseg)) < 0)
- X+ perror_with_name (filename);
- X+ if ( xseg.xs_type != XS_TDATA )
- X+ error ("\"%s\": Data segment isn't second (huh?).", execfile);
- X+ data_segid = xseg.xs_seg;
- X+ exec_data_start = xseg.xs_rbase;
- X+ exec_data_end = exec_data_start + xseg.xs_psize;
- X+ exec_data_offset = xseg.xs_filpos;
- X+ data_start = exec_data_start;
- X+ data_end += exec_data_start;
- X+
- X+ fstat (execchan, &st_exec);
- X+ exec_mtime = st_exec.st_mtime;
- X+ free(extended_header);
- X+ }
- X+ #else /* not M_XENIX */
- X struct stat st_exec;
- X
- X #ifdef HEADER_SEEK_FD
- X***************
- X*** 549,554 ****
- X--- 671,677 ----
- X fstat (execchan, &st_exec);
- X exec_mtime = st_exec.st_mtime;
- X }
- X+ #endif /* not M_XENIX */
- X #endif /* not COFF_FORMAT */
- X
- X validate_files ();
- X***************
- X*** 1056,1061 ****
- X--- 1179,1195 ----
- X
- X struct env387
- X {
- X+ #ifdef M_XENIX
- X+ unsigned int control;
- X+ unsigned int status;
- X+ unsigned int tag;
- X+ unsigned long eip;
- X+ unsigned short code_seg;
- X+ unsigned short operand_seg;
- X+ unsigned long opcode;
- X+ unsigned long operand;
- X+ unsigned char regs[8][10];
- X+ #else
- X unsigned short control;
- X unsigned short r0;
- X unsigned short status;
- X***************
- X*** 1069,1074 ****
- X--- 1203,1209 ----
- X unsigned short operand_seg;
- X unsigned short r3;
- X unsigned char regs[8][10];
- X+ #endif
- X };
- X
- X static
- X***************
- X*** 1145,1150 ****
- X--- 1280,1289 ----
- X int fpreg;
- X unsigned char *p;
- X
- X+ #ifdef M_XENIX
- X+ if (ep->status != 0)
- X+ print_387_status_word (ep->status);
- X+ #else
- X bothstatus = ((status != 0) && (ep->status != 0));
- X if (status != 0)
- X {
- X***************
- X*** 1159,1164 ****
- X--- 1298,1304 ----
- X printf ("e: ");
- X print_387_status_word (ep->status);
- X }
- X+ #endif
- X
- X print_387_control_word (ep->control);
- X printf ("last exception: ");
- X***************
- X*** 1188,1193 ****
- X--- 1328,1334 ----
- X i387_to_double (ep->regs[fpreg], (char *)&val);
- X printf (" %g\n", val);
- X }
- X+ #ifndef M_XENIX
- X if (ep->r0)
- X printf ("warning: reserved0 is 0x%x\n", ep->r0);
- X if (ep->r1)
- X***************
- X*** 1196,1201 ****
- X--- 1337,1343 ----
- X printf ("warning: reserved2 is 0x%x\n", ep->r2);
- X if (ep->r3)
- X printf ("warning: reserved3 is 0x%x\n", ep->r3);
- X+ #endif
- X }
- X
- X #ifndef U_FPSTATE
- X***************
- X*** 1270,1275 ****
- X--- 1412,1421 ----
- X }
- X
- X fpstatep = (struct fpstate *)(buf + skip);
- X+ #ifdef M_XENIX
- X+ print_387_status (0, (struct env387 *)fpstatep);
- X+ #else
- X print_387_status (fpstatep->status, (struct env387 *)fpstatep->state);
- X+ #endif
- X }
- X
- X*** 3.5/infrun.c Wed Jan 24 00:10:35 1990
- X--- infrun.c Thu Aug 1 18:01:35 1991
- X***************
- X*** 146,151 ****
- X--- 146,156 ----
- X /* Needed by IN_SIGTRAMP on some machines (e.g. vax). */
- X #include <sys/param.h>
- X /* Needed by IN_SIGTRAMP on some machines (e.g. vax). */
- X+ #ifdef M_XENIX
- X+ struct user; struct buf; struct inode; struct proc; /* inhibit warnings */
- X+ #include <sys/page.h>
- X+ #include <sys/seg.h>
- X+ #endif
- X #include <sys/user.h>
- X
- X extern char *sys_siglist[];
- X*** 3.5/m-xenix386.h
- X--- m-xenix386.h Thu Aug 1 18:01:35 1991
- X***************
- X*** 0 ****
- X--- 1,30 ----
- X+ /* SCO XENIX 386 version. Mostly like System V/386 3.2 */
- X+ #include "m-i386-sv32.h"
- X+
- X+ /* define this if your DEVELOPMENT system is older than 2.3 */
- X+ /* #define PTRACE_ADDR_ARG_STRUCT */
- X+
- X+ #define const /* workaround for SCO's include files */
- X+ /* This machine doesn't have the siginterrupt call. */
- X+ #define NO_SIGINTERRUPT
- X+ #define NAMES_HAVE_UNDERSCORE
- X+ /* support dbx-style debugging in x.out executables produced by
- X+ the accompanying port of GCC */
- X+ #undef COFF_FORMAT
- X+ #define READ_DBX_FORMAT
- X+ #undef START_INFERIOR_TRAPS_EXPECTED
- X+ #define START_INFERIOR_TRAPS_EXPECTED 2
- X+ #undef KERNEL_U_ADDR
- X+ #define KERNEL_U_ADDR 0x06000000
- X+ #undef FIX_CALL_DUMMY
- X+ #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, type) \
- X+ { \
- X+ extern CORE_ADDR text_end; \
- X+ int from, to, delta, loc; \
- X+ loc = text_end - CALL_DUMMY_LENGTH; \
- X+ from = loc + 5; \
- X+ to = (int)(fun); \
- X+ delta = to - from; \
- X+ *(int *)((char *)(dummyname) + 1) = delta; \
- X+ }
- X+ #define CANNOT_EXECUTE_STACK
- X*** 3.5/munch Wed Jul 5 20:46:28 1989
- X--- munch Thu Aug 1 18:01:35 1991
- X***************
- X*** 5,17 ****
- X echo '/* Do not modify this file. It is created automatically by "munch". */'
- X echo 'void initialize_all_files () {'
- X
- X! if test "$1" = "-DSYSV" ; then
- X shift;
- X nm $* | egrep '^(.*[^a-zA-Z_]_|_)initialize_' | \
- X sed -e 's/^.*\(_initialize_[a-zA-Z0-9_]*\)[^a-zA-Z0-9_].*$/ \1 ();/'
- X else
- X nm -p $* | egrep 'T *__initialize_' | \
- X sed -e 's/^.*T *_*\(.*\)/ _\1 ();/'
- X fi
- X
- X echo '}'
- X--- 5,22 ----
- X echo '/* Do not modify this file. It is created automatically by "munch". */'
- X echo 'void initialize_all_files () {'
- X
- X! if [ -f /xenix ]; then
- X shift;
- X+ nm $* | egrep 'A *__initialize_' | \
- X+ sed -e 's/^.*A *_*\(.*\)/ _\1 ();/'
- X+ else if test "$1" = "-DSYSV" ; then
- X+ shift;
- X nm $* | egrep '^(.*[^a-zA-Z_]_|_)initialize_' | \
- X sed -e 's/^.*\(_initialize_[a-zA-Z0-9_]*\)[^a-zA-Z0-9_].*$/ \1 ();/'
- X else
- X nm -p $* | egrep 'T *__initialize_' | \
- X sed -e 's/^.*T *_*\(.*\)/ _\1 ();/'
- X+ fi
- X fi
- X
- X echo '}'
- X*** 3.5/readline/Makefile Thu Feb 8 07:05:33 1990
- X--- readline/Makefile Thu Aug 1 18:01:43 1991
- X***************
- X*** 38,44 ****
- X # A good alternative is gcc -traditional.
- X #CC = gcc -traditional
- X CC = cc
- X! RANLIB = /usr/bin/ranlib
- X AR = ar
- X RM = rm
- X CP = cp
- X--- 38,44 ----
- X # A good alternative is gcc -traditional.
- X #CC = gcc -traditional
- X CC = cc
- X! RANLIB = /bin/ranlib
- X AR = ar
- X RM = rm
- X CP = cp
- X*** 3.5/readline/readline.c Sun Nov 26 22:31:36 1989
- X--- readline/readline.c Thu Aug 1 18:01:45 1991
- X***************
- X*** 68,73 ****
- X--- 68,77 ----
- X
- X #define HACK_TERMCAP_MOTION
- X
- X+ #ifdef M_XENIX
- X+ #include <sys/ttold.h>
- X+ #include <sys/ndir.h>
- X+ #else
- X #ifndef SYSV
- X #include <sys/dir.h>
- X #else /* SYSV */
- X***************
- X*** 79,84 ****
- X--- 83,89 ----
- X #define d_namlen d_reclen
- X #endif /* hpux */
- X #endif /* SYSV */
- X+ #endif
- X
- X /* Some standard library routines. */
- X #include "readline.h"
- X*** 3.5/symtab.h Fri Sep 8 01:59:14 1989
- X--- symtab.h Thu Aug 1 18:01:46 1991
- X***************
- X*** 149,154 ****
- X--- 149,157 ----
- X to take a *lot* of time; check) or an error (and we don't care
- X how long errors take). */
- X int statics_offset, n_static_syms;
- X+ #ifdef M_XENIX
- X+ int stringtab_off;
- X+ #endif /* M_XENIX */
- X };
- X
- X /* This is the list of struct symtab's that gdb considers current. */
- X*** 3.5/values.c Sun Sep 10 04:39:19 1989
- X--- values.c Thu Aug 1 18:01:48 1991
- X***************
- X*** 1024,1028 ****
- X
- X add_info ("values", value_history_info,
- X "Elements of value history (around item number IDX, or last ten).");
- X! add_info_alias ("history", value_history_info, 0);
- X }
- X--- 1024,1028 ----
- X
- X add_info ("values", value_history_info,
- X "Elements of value history (around item number IDX, or last ten).");
- X! /* add_info_alias ("history", value_history_info, 0); */
- X }
- X*** 3.5/x386dbx.c
- X--- x386dbx.c Thu Aug 1 18:01:50 1991
- X***************
- X*** 0 ****
- X--- 1,481 ----
- X+ #include <stdio.h>
- X+ #include <a.out.h>
- X+ #include <fcntl.h>
- X+ #include <sys/types.h>
- X+ #include <sys/relsym.h>
- X+ #include <sys/param.h>
- X+ #include <sys/file.h>
- X+ #include "defs.h"
- X+ #include "param.h"
- X+ #include "symtab.h"
- X+ #include "gas-nlist.h"
- X+
- X+
- X+ /* XENIX symbol segment shape definitions */
- X+
- X+ struct section2 { /* File info table shape */
- X+ short segment; /* segment number */
- X+ CORE_ADDR address; /* start address for this file */
- X+ unsigned short textsize; /* size of the text for this file */
- X+ long type3off; /* offset to type3 records, psym tab */
- X+ long type4off; /* offset to type4 records, nlist tab */
- X+ long type5off; /* offset to type5 records, str tab */
- X+ long type6off; /* offset to type6 records */
- X+ unsigned short type3sz; /* size of type3 records */
- X+ unsigned short type4sz; /* size of type4 records */
- X+ unsigned short type5sz; /* size of type5 records */
- X+ unsigned short type6sz; /* size of type6 records */
- X+ char filelen; /* length of filename */
- X+ };
- X+
- X+ /* psymtable (attribute 3) symbol segment shape */
- X+
- X+ struct psymbol_seg {
- X+ long address; /* core address */
- X+ short segid; /* segment number */
- X+ short typeid; /* variable's type */
- X+ char varlen; /* variable's length */
- X+ /* char name[0]; trailing name varlen long */
- X+ } record3;
- X+
- X+ /* Info maintenance structures */
- X+
- X+ struct fileinfo { /* per file info */
- X+ CORE_ADDR address; /* start address for this file */
- X+ unsigned short textsize; /* size of text for this file */
- X+ long psymoff; /* psyms table */
- X+ long strtaboff; /* string table aka $$TYPES */
- X+ long ntaboff; /* nlist table aka $$SYMBOLS */
- X+ unsigned short psymsz; /* size of psyms table */
- X+ unsigned short strtabsz; /* size of string table */
- X+ unsigned short ntabsz; /* size of nlist table */
- X+ int mscdebuginfo; /* compiled with cc -g not gcc -g */
- X+ char *filename; /* name of this file */
- X+ struct fileinfo *next;
- X+ };
- X+
- X+ static struct fileinfo *fi_table = 0;
- X+ struct xseg *seg_table;
- X+ long num_seg_table_entries;
- X+
- X+ #ifdef __GNUC__
- X+ #define alloca __builtin_alloca
- X+ #endif
- X+
- X+ #define IGNORE_ATTR (-1)
- X+
- X+ static read_fileinfo_table(fp, segsize, name)
- X+ FILE *fp;
- X+ int segsize;
- X+ char *name;
- X+ {
- X+ extern char *strrchr(), *xmalloc();
- X+ char *fi_name;
- X+ char *filename;
- X+ struct section2 fi_entry;
- X+ struct fileinfo *fi;
- X+
- X+ fi_table = fi = (struct fileinfo *)xmalloc(sizeof(struct fileinfo));
- X+ while (segsize > 0)
- X+ {
- X+ if ((fread((char *)&fi_entry.segment, sizeof(short), 1, fp) != 1)
- X+ || (fread((char *)&fi_entry.address, sizeof(CORE_ADDR), 1, fp) != 1)
- X+ || (fread((char *)&fi_entry.textsize, sizeof(unsigned short),1,fp) != 1)
- X+ || (fread((char *)&fi_entry.type3off, sizeof(long), 1, fp) != 1)
- X+ || (fread((char *)&fi_entry.type4off, sizeof(long), 1, fp) != 1)
- X+ || (fread((char *)&fi_entry.type5off, sizeof(long), 1, fp) != 1)
- X+ || (fread((char *)&fi_entry.type6off, sizeof(long), 1, fp) != 1)
- X+ || (fread((char *)&fi_entry.type3sz, sizeof(unsigned short),1,fp) != 1)
- X+ || (fread((char *)&fi_entry.type4sz, sizeof(unsigned short),1,fp) != 1)
- X+ || (fread((char *)&fi_entry.type5sz, sizeof(unsigned short),1,fp) != 1)
- X+ || (fread((char *)&fi_entry.type6sz, sizeof(unsigned short),1,fp) != 1)
- X+ || (fread((char *)&fi_entry.filelen, sizeof(char), 1, fp) != 1))
- X+ perror_with_name(name);
- X+
- X+ segsize -= sizeof(short) + sizeof(CORE_ADDR) + 5 * sizeof(unsigned short)
- X+ + 4 * sizeof(long) + sizeof(char);
- X+
- X+ fi_name = alloca(fi_entry.filelen + 1);
- X+ if (fread(fi_name, fi_entry.filelen, 1, fp) != 1)
- X+ perror_with_name(name);
- X+ fi_name[fi_entry.filelen] = '\0';
- X+ segsize -= fi_entry.filelen;
- X+
- X+ if ((filename = strrchr(fi_name, '/')) != (char *)0)
- X+ fi_name = filename + 1;
- X+
- X+ if ((filename = strrchr(fi_name, '(')) != (char *)0)
- X+ fi_name = filename + 1;
- X+
- X+ if ((filename = strrchr(fi_name, ')')) != (char *)0)
- X+ *filename = '\0';
- X+
- X+ {
- X+ int len = strlen(fi_name);
- X+
- X+ if (len > 2 && fi_name[len - 1] == 'o' && fi_name[len - 2] == '.')
- X+ fi_name[len - 1] = 'c';
- X+ }
- X+
- X+ fi_name = savestring(fi_name, strlen(fi_name) + 1);
- X+
- X+ fi->next = (struct fileinfo *)xmalloc(sizeof(struct fileinfo));
- X+ fi = fi->next;
- X+
- X+ fi->address = fi_entry.address;
- X+ fi->textsize = fi_entry.textsize;
- X+ fi->psymoff = fi_entry.type3off;
- X+ fi->psymsz = fi_entry.type3sz;
- X+ fi->strtaboff = fi_entry.type4off;
- X+ fi->strtabsz = fi_entry.type4sz;
- X+ fi->ntaboff = fi_entry.type5off;
- X+ fi->ntabsz = fi_entry.type5sz;
- X+ fi->mscdebuginfo = (fi_entry.type6sz != 0);
- X+ fi->filename = fi_name;
- X+ }
- X+ fi->next = 0; fi = fi_table; fi_table = fi_table->next; free(fi);
- X+
- X+ #ifdef X_DEBUG
- X+ printf("\naddress textsz symoff symsz stroff strsz taboff tabsz name\n\n");
- X+ for (fi = fi_table; fi != 0; fi = fi->next)
- X+ {
- X+ printf("% 8x % 6d % 6d % 6d % 6d % 6d % 6d %6d %s\n", fi->address, fi->textsize, fi->psymoff, fi->psymsz, fi->strtaboff, fi->strtabsz, fi->ntaboff, fi->ntabsz, fi->filename);
- X+ }
- X+ printf("\n");
- X+ #endif /* X_DEBUG */
- X+ }
- X+
- X+ static read_seg_table(fp, pos, size, name)
- X+ FILE *fp;
- X+ long pos, size;
- X+ {
- X+ seg_table = (struct xseg *) xmalloc(size);
- X+ fseek(fp, pos, 0);
- X+ if (fread((char *)seg_table, size, 1, fp) != 1)
- X+ perror_with_name(name);
- X+ num_seg_table_entries = size / sizeof (struct xseg);
- X+ }
- X+
- X+
- X+ struct xseg *find_segment(type, attr)
- X+ int type, attr;
- X+ {
- X+ struct xseg *cseg;
- X+
- X+ for (cseg = seg_table; cseg < seg_table + num_seg_table_entries; ++cseg)
- X+ if (cseg->xs_type == type &&
- X+ (attr == IGNORE_ATTR || attr == cseg->xs_attr))
- X+ return cseg;
- X+ return NULL;
- X+ }
- X+
- X+ static int compare_misc_functions (fn1, fn2)
- X+ struct misc_function *fn1, *fn2;
- X+ {
- X+ /* Return a signed result based on unsigned comparisons
- X+ so that we sort into unsigned numeric order. */
- X+
- X+ if (fn1->address < fn2->address)
- X+ return -1;
- X+ if (fn1->address > fn2->address)
- X+ return 1;
- X+ return 0;
- X+ }
- X+
- X+ static int read_misc_functions(fp, segsize, name)
- X+ FILE *fp;
- X+ int segsize;
- X+ char *name;
- X+ {
- X+ char *symdata, *p, *str_buff;
- X+ long sym_count = 0, str_count = 0, i;
- X+ struct misc_function *miscp;
- X+ struct sym symb;
- X+
- X+ /* grab the symbol table */
- X+
- X+ symdata = alloca(segsize + 1);
- X+ if (fread(symdata, segsize, 1, fp) != 1)
- X+ perror_with_name(name);
- X+
- X+ /* first pass, work out how many symbols there are and the size of the
- X+ * strings
- X+ */
- X+
- X+ p = symdata;
- X+ while (p < symdata + segsize)
- X+ {
- X+ int len;
- X+
- X+ p += sizeof(struct sym);
- X+ len = strlen(p) + 1;
- X+ str_count += len; p += len; sym_count++;
- X+ }
- X+
- X+ /* Now build the misc function vector */
- X+
- X+ str_buff = xmalloc(str_count+1);
- X+ misc_function_vector =
- X+ (struct misc_function *) xmalloc (sym_count * sizeof(struct misc_function));
- X+ misc_function_count = sym_count;
- X+
- X+ p = symdata; miscp = misc_function_vector;
- X+ while (p < symdata + segsize)
- X+ {
- X+ int len;
- X+
- X+ symb = *((struct sym *)p);
- X+ p += sizeof(struct sym);
- X+
- X+ if (*p == '_')
- X+ strcpy(str_buff, p+1);
- X+ else
- X+ strcpy(str_buff, p);
- X+
- X+ /* the following will result in a garbage byte every time a symbol
- X+ * starts with a _, I can'y be bothered to fix it.
- X+ */
- X+
- X+ miscp->name = str_buff;
- X+ len = strlen(p) + 1;
- X+ str_buff += len; p += len;
- X+ miscp->address = symb.s_value;
- X+ switch(symb.s_type & S_TYPE)
- X+ {
- X+ case S_UNDEF: miscp->type = mf_unknown; break;
- X+ case S_ABS: miscp->type = mf_abs; break;
- X+ case S_TEXT: miscp->type = mf_text; break;
- X+ case S_DATA: miscp->type = mf_data; break;
- X+ case S_BSS: miscp->type = mf_bss; break;
- X+ case S_COMM: miscp->type = mf_data; break;
- X+ case S_REG: miscp->type = mf_unknown; break;
- X+ case S_COMB: miscp->type = mf_unknown; break;
- X+ case S_SEG: miscp->type = mf_unknown; break;
- X+ case S_FN: miscp->type = mf_unknown; break;
- X+ dewfault: miscp->type = mf_unknown; break;
- X+ }
- X+ miscp++;
- X+ }
- X+
- X+ qsort (misc_function_vector, misc_function_count,
- X+ sizeof (struct misc_function), compare_misc_functions);
- X+
- X+ #ifdef X_DEBUG
- X+ {
- X+ struct misc_function *miscp;
- X+ int i;
- X+
- X+ printf("type address name\n\n");
- X+ for (i = 0; i < misc_function_count; i++)
- X+ {
- X+ miscp = &misc_function_vector[i];
- X+ switch (miscp->type)
- X+ {
- X+ case mf_unknown: printf("%-9s","unknown"); break;
- X+ case mf_text: printf("%-9s","text"); break;
- X+ case mf_data: printf("%-9s","data"); break;
- X+ case mf_bss: printf("%-9s","bss"); break;
- X+ case mf_abs: printf("%-9s","abs"); break;
- X+ default: printf("%-9s","UNKNOWN"); break;
- X+ }
- X+ printf("% 8x ", miscp->address);
- X+ printf("%s\n", miscp->name);
- X+ }
- X+ }
- X+ #endif /* X_DEBUG */
- X+ return misc_function_count;
- X+ }
- X+
- X+ process_a_out(desc, name)
- X+ int desc;
- X+ char *name;
- X+ {
- X+ struct xexec exec_aouthdr;
- X+ struct xext *xext;
- X+ struct xseg *cseg;
- X+ FILE *fp;
- X+
- X+ lseek(desc, 0L, 0);
- X+ if ((fp = fdopen(dup(desc), "r")) == NULL)
- X+ perror_with_name(name);
- X+
- X+ if (fread((char *)&exec_aouthdr, sizeof(struct xexec), 1, fp) != 1)
- X+ perror_with_name(name);
- X+
- X+ xext = (struct xext *) alloca(exec_aouthdr.x_ext);
- X+ if (fread((char *)xext, exec_aouthdr.x_ext, 1, fp) != 1)
- X+ perror_with_name(name);
- X+
- X+ read_seg_table(fp, xext->xe_segpos, xext->xe_segsize, name);
- X+
- X+ if (cseg = find_segment(XS_TSYMS, 2))
- X+ {
- X+ fseek(fp, cseg->xs_filpos, 0);
- X+ read_fileinfo_table(fp, cseg->xs_psize, name);
- X+ }
- X+
- X+ fclose(fp);
- X+ }
- X+
- X+ process_global_symbol_table(desc, name)
- X+ int desc;
- X+ char *name;
- X+ {
- X+ struct xseg *cseg;
- X+ FILE *fp;
- X+
- X+ if ((fp = fdopen(dup(desc), "r")) == NULL)
- X+ perror_with_name(name);
- X+
- X+ if (cseg = find_segment(XS_TSYMS, 1))
- X+ {
- X+ fseek(fp, cseg->xs_filpos, 0);
- X+ read_misc_functions(fp, cseg->xs_psize, name);
- X+ }
- X+ fclose(fp);
- X+ }
- X+
- X+ static struct fileinfo *current_fi;
- X+ static int first_get_fileinfo_call = 1;
- X+
- X+ init_fileinfo_processing() /* start processing the list of files */
- X+ {
- X+ first_get_fileinfo_call = 1;
- X+ }
- X+
- X+ long get_next_fileinfo(stroff, nsyms, address, symtaboff, textsize)
- X+ long *stroff, *nsyms, *address, *symtaboff, *textsize;
- X+ {
- X+ struct xseg *cseg;
- X+
- X+ if (first_get_fileinfo_call)
- X+ {
- X+ current_fi = fi_table;
- X+ first_get_fileinfo_call = 0;
- X+ }
- X+ else
- X+ current_fi = current_fi->next;
- X+
- X+ if (current_fi == 0)
- X+ return 0;
- X+
- X+ if (current_fi->mscdebuginfo)
- X+ {
- X+ *stroff = 0;
- X+ *nsyms = 0;
- X+ *address = current_fi->address;
- X+ *textsize = current_fi->textsize;
- X+ }
- X+ else if (cseg = find_segment(XS_TSYMS, 5))
- X+ {
- X+ *symtaboff = cseg->xs_filpos + current_fi->ntaboff;
- X+ *stroff = current_fi->strtaboff;
- X+ *nsyms = current_fi->ntabsz / sizeof(struct gas_nlist);
- X+ *address = current_fi->address;
- X+ *textsize = current_fi->textsize;
- X+ return 1;
- X+ }
- X+ else
- X+ {
- X+ *symtaboff = 0;
- X+ *stroff = 0;
- X+ *nsyms = 0;
- X+ *address = 0;
- X+ *textsize = 0;
- X+ }
- X+ }
- X+
- X+ #ifdef TEST
- X+
- X+ main()
- X+ {
- X+ char *stab;
- X+ long str_offset, nsyms, address, ntaboff, textsize;
- X+ int desc;
- X+ struct xseg *cseg;
- X+
- X+ process_a_out((desc = open("a.out", O_RDONLY, 0)), "a.out");
- X+
- X+ printf("\n");
- X+
- X+ if (cseg = find_segment(XS_TSYMS, 4))
- X+ {
- X+ lseek(desc, cseg->xs_filpos, 0);
- X+ stab = alloca(cseg->xs_psize);
- X+ read(desc, stab, cseg->xs_psize);
- X+ }
- X+ else
- X+ stab = 0;
- X+
- X+ init_fileinfo_processing();
- X+ while (get_next_fileinfo(&str_offset,&nsyms,&address,&ntaboff,&textsize))
- X+ {
- X+ lseek(desc, ntaboff, 0);
- X+ printf("\n type desc value stroff string tsize (%#x)\n", address);
- X+ while (nsyms--)
- X+ {
- X+ struct gas_nlist nl;
- X+
- X+ read(desc, &nl, sizeof(nl));
- X+ printf("% 6x % 6x % 8x % 6x % 6x %s\n",
- X+ (unsigned char)nl.n_type,
- X+ (unsigned short)nl.n_desc,
- X+ (unsigned int)nl.n_value,
- X+ nl.n_un.n_strx ? stab + str_offset + nl.n_un.n_strx : "");
- X+ }
- X+ lseek(desc, 0L, 0);
- X+ }
- X+ }
- X+
- X+ perror_with_name (string)
- X+ char *string;
- X+ {
- X+ extern int sys_nerr;
- X+ extern char *sys_errlist[];
- X+ extern int errno;
- X+ char *err;
- X+ char *combined;
- X+
- X+ if (errno < sys_nerr)
- X+ err = sys_errlist[errno];
- X+ else
- X+ err = "unknown error";
- X+
- X+ combined = (char *) alloca (strlen (err) + strlen (string) + 3);
- X+ strcpy (combined, string);
- X+ strcat (combined, ": ");
- X+ strcat (combined, err);
- X+
- X+ error ("%s.", combined);
- X+ }
- X+
- X+ error (string, arg1, arg2, arg3)
- X+ char *string;
- X+ int arg1, arg2, arg3;
- X+ {
- X+ fflush (stdout);
- X+ fprintf (stderr, string, arg1, arg2, arg3);
- X+ fprintf (stderr, "\n");
- X+ exit(1);
- X+ }
- X+
- X+ char * xmalloc (size)
- X+ long size;
- X+ {
- X+ register char *val = (char *) malloc (size);
- X+ if (!val)
- X+ error ("virtual memory exhausted.");
- X+ return val;
- X+ }
- X+
- X+ char *savestring (ptr, size)
- X+ char *ptr;
- X+ int size;
- X+ {
- X+ register char *p = (char *) xmalloc (size + 1);
- X+ memcpy(p, ptr, size);
- X+ p[size] = 0;
- X+ return p;
- X+ }
- X+
- X+ #endif /* TEST */
- X*** gdbspace.asm
- X--- gdbspace.asm Thu Aug 22 20:27:38 1991
- X***************
- X*** 0 ****
- X--- 1,14 ----
- X+ ; GDB likes to poke calling sequences beyond _end -- in the padding
- X+ ; space up to the end of the page.
- X+ ; But XENIX doesn't let it use this space, so we have to add the space
- X+ ; manually. Assemble and install this file with the command
- X+ ; /usr/lib/storel gdbspace.asm && mv gdbspace.o /usr/local/lib/libgdb.a
- X+ ; and use it by specifying -lgdb when you're debugging.
- X+ ; e.g. gcc -g foo.c -o foo -lgdb
- X+ ; This will enable you to do things like call functions from within gdb
- X+ .386
- X+ C_ETEXT SEGMENT DWORD USE32 PUBLIC 'ENDCODE'
- X+ PUBLIC SPACE_FOR_GDB_TO_USE
- X+ SPACE_FOR_GDB_TO_USE DB 512 DUP (0)
- X+ C_ETEXT ENDS
- X+ END
- X
- END_OF_FILE
- if test 46618 -ne `wc -c <'gdb-3.5b.pch'`; then
- echo shar: \"'gdb-3.5b.pch'\" unpacked with wrong size!
- fi
- # end of 'gdb-3.5b.pch'
- fi
- echo shar: End of archive.
- exit 0
- --
- Steve.Bleazard@RoboBar.Co.Uk | Phone: +44 81 991 1142 x153
- Snr Software Engineer, Robobar Ltd. | Fax: +44 81 998 8343 (G3)
- 22 Wadsworth Road, Perivale. |
- Middx., UB6 7JD ENGLAND. | ...!ukc!robobar!steve
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-